$(function () {
    function search_recommend () {
        var types = 0;
        if ($('.picker').text().indexOf("图片") != -1)
            types = 1;
        $.get('/search_recommend/', {'types': types}, function (data) {
            data = JSON.parse(data);
            if (data.status == 200) {
                var id_pool = [];
                var targets = [];
                for (var i = 0; i < data.info.length; i++) {
                    var each = data.info[i];
                    id_pool.push(each.id);
                    if (types)
                        targets.push(each.target);
                    else
                        targets.push(each.movie_name);
                }
                helangSearch.hot.list = targets;
                helangSearch.hot.id = id_pool;
                helangSearch.init();
            }
        })
    }

    $("#search-input").click(function () {
        search_recommend();
    })
});